/*
 * @Description:
 * @Version: 1.0
 * @Autor: wangmeng
 * @Date: 2024-01-18 13:49:57
 * @LastEditors: wamgmeng
 * @LastEditTime: 2024-01-19 20:22:54
 */
import { createApp, reactive } from "vue";
import "./style/index.scss";
import {
  ElButton,
  ElInput,
  ElSelect,
  ElInputNumber,
  ElTabs,
  ElTable,
  ElTableColumn,
  ElDialog,
  ElDatePicker,
  ElConfigProvider,
  ElPagination,
  ElForm,
  ElFormItem,
  ElIcon,
  ElMessage,
  ElMessageBox,
  ElMenu,
  ElMenuItem,
} from "element-plus";
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
import App from "./App.vue";
import router from "./router";
// import "@/assets/js/rem.js";
import "@/assets/css/reset.css";
import "@/assets/css/common.scss";
import "@/assets/font/font.css";
import "@/assets/iconfont/iconfont.css";
import { getSystemDefaultDataAPI } from "@/api/service/systemData";

// 获取区域数据
const globalData = reactive({
  areaList: [],
  channelList: [],
  programList: [],
  terminalList: [],
  defaultTerminalPreviewUrl: "",
  defaultChannelPreviewUrl: "",
  defaultProgramPreviewUrl: "",
});
function getSystemDefaultData() {
  getSystemDefaultDataAPI().then((_data: any) => {
    const data = _data;
    globalData.areaList = data.areaList;
    globalData.channelList = data.channelList;
    globalData.programList = data.programList;
    globalData.terminalList = data.terminalList;
    globalData.defaultTerminalPreviewUrl = data.defaultTerminalPreviewUrl;
    globalData.defaultChannelPreviewUrl = data.defaultChannelPreviewUrl;
    globalData.defaultProgramPreviewUrl = data.defaultProgramPreviewUrl;
  });
}
getSystemDefaultData();

const app = createApp(App);
app.config.globalProperties.$globalData = globalData;

app
  .use(ElButton)
  .use(ElInput)
  .use(ElSelect)
  .use(ElInputNumber)
  .use(ElTabs)
  .use(ElTable)
  .use(ElTableColumn)
  .use(ElDialog)
  .use(ElDatePicker)
  .use(ElForm)
  .use(ElFormItem)
  .use(ElConfigProvider, { locale: zhCn })
  .use(ElPagination)
  .use(ElIcon)
  .use(ElMessage)
  .use(ElMessageBox)
  .use(ElMenu)
  .use(ElMenuItem)
  .use(router)
  .mount("#app");
